package com.guocloud.medimind.config;

import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.client.advisor.api.Advisor;
import org.springframework.ai.chat.model.ChatModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Ollama模型配置类
 * 用于配置本地部署的Ollama大模型
 */
@Configuration
public class OllamaChatModelConfig {
    
    @Autowired
    @Qualifier("ollamaChatModel")  // 引用已存在的ollamaChatModel Bean
    private ChatModel ollamaChatModel;
    
    @Autowired
    private Advisor loggerAdvisor;
    
    /**
     * 创建使用Ollama模型的ChatClient
     */
    @Bean
    @Qualifier("ollamaChatClient")
    public ChatClient ollamaChatClient() {
        return ChatClient.builder(ollamaChatModel)
                .defaultAdvisors(loggerAdvisor)
                .build();
    }
} 